{extend name="admin@admin:base_admin_builder" /}
{block name="style"}
<style>
    .head-check {
        width: 30px;
    }
    .button-group {
        padding: 10px;
    }
    thead {
        background-color: #222222;
        color: #DDDDDD;
    }
</style>
{/block}

{block name="content"}
<div class="button-group clearfix">
    <!--搜索框-->
    {notempty name="_searchUrl"}
        {include file="admin@list_builder_widget:search" /}
    {/notempty}
    <!--搜索框 end-->
    <!--其他按钮-->
    {peter:foreach exp="$_buttonList as $_item"}
        <button {$_item.attr}>{$_item.title}</button>
    {/peter:foreach}
    <!--其他按钮 end-->
    <!--选择框-->
    {notempty name="_selectUrl"}
        {include file="admin@list_builder_widget:select" /}
    {/notempty}
    <!--选择框 end-->

</div>
<table class="table table-hover table-bordered">
    <thead>
        <tr>
            <th class="head-check"><input id="check-all-id" type="checkbox"></th>
            {peter:foreach exp="$_keyList as $_item"}
                    <th>{$_item.title}</th>
            {/peter:foreach}
        </tr>
    </thead>
    <tbody>
        {peter:foreach exp="$_data as $_value"}
            <tr>
                <th class="head-check">
                    {peter:if exp="isset($_value['id'])"}
                    <input class="check-id" type="checkbox" name="ids[]" value="{$_value.id}">
                    {/peter:if}
                </th>

                {peter:foreach exp="$_keyList as $_item"}
                    <td>
                        {switch name="_item.type"}
                            {include file="admin@list_builder_widget:text" /}
                            {include file="admin@list_builder_widget:link" /}
                            {include file="admin@list_builder_widget:urlimage" /}
                            {include file="admin@list_builder_widget:image" /}
                            {include file="admin@list_builder_widget:multiimage" /}
                            {include file="admin@list_builder_widget:doaction" /}
                        {/switch}
                    </td>
                {/peter:foreach}
            </tr>
        {/peter:foreach}

    </tbody>
</table>
{notempty name='_pagination'}
<nav class="clearfix">
    <ul class="pagination pull-right">
        {$_pagination->prePageHtml}
        {peter:foreach exp="$_pagination->showPages as $_page"}
            {$_page}
        {/peter:foreach}
        {$_pagination->nextPageHtml}
    </ul>
</nav>
{/notempty}
{/block}

{block name="script"}
<script>
    $('#check-all-id').on('click',function(){
        if($(this).prop("checked")) {
            $(".check-id").prop('checked',true);
        }else {
            $(".check-id").prop('checked',false);
        }

    });
</script>
{/block}